<?php
class H_BaseCateEntity extends H_B{
	public function isExistsEntity($cate_id){
            $select = $this->_db->select();
            $select->from($this->_name,array('cate_id'))
                       ->where("cate_id = ?",$cate_id)
                       ->limit(1);
                       ;
            $result = $this->_db->fetchOne($select);
            return !empty($result);
	} 
	public function delbycate($cate_id){
            $where = $this->_db->quoteInto('cate_id = ?', $cate_id);
            return $this->delete($where);
	}
	public function delbyentity($entity_id){
            $where = $this->_db->quoteInto('entity_id = ?', $entity_id);
            return $this->delete($where);
	}

        public function getCate_by_Entity($entity_id){
            $select = $this->_db->select();
            $select->from($this->_name,array('cate_id'))
                    ->where('entity_id = ?',$entity_id);
            $result = $this->_db->fetchAll($select,null,Zend_Db::FETCH_UNIQUE);
            return array_keys($result);
        }
}